/*
 * FlightControllerInbox.cpp
 *
 *  Created on: Sep 5, 2013
 *      Author: gonprieto
 */

#include "FlightControllerInbox.h"
#include "../DTO/DTOFlightControler.h"
#include "../DTO/DTORunwayRelated.h"
#include "../../utils/Logger.h"

FlightControllerInbox::FlightControllerInbox(std::string fifoName,bool esLectura) : FifoProtocoloPlano(fifoName,esLectura){
}

FlightControllerInbox::~FlightControllerInbox(){
	Logger::instancia() << "FlightControllerInbox::~FlightControllerInbox - Se cierra el inbox!" << eol;
}

void FlightControllerInbox::endShift(unsigned int controllerId){
	Logger::instancia() << "FlightControllerInbox::endShift - End shift message" << eol;
	DTOFlightControler dto(true,controllerId);
	escribirDTO(dto);
}

void FlightControllerInbox::asignarRunway(unsigned int runwayId){
	Logger::instancia() << "FlightControllerInbox::asignarRunway - Asigno runway" << eol;
	DTORunwayRelated dto(REQUEST_RUNWAY,runwayId);
	escribirDTO(dto);
}

//Mensaje de avion en el aire
void FlightControllerInbox::landFlight(DTOFlightToLand& flight){
	Logger::instancia() << "FlightControllerInbox::landFlight - land flight message" << eol;
	escribirDTO(flight);
}

//Mensaje de avion en tierra
void FlightControllerInbox::takeOffFlight(DTOFlightToTakeOff& flight){
	Logger::instancia() << "FlightControllerInbox::takeOffFlight - takeOff flight message" << eol;
	escribirDTO(flight);
}

